package com.dms.model;

import java.util.*;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Building entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "building", catalog = "sushe")
public class Building implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	// Fields

	private Integer id;
	private String name;
	private String introduction;
	private List<Domitory> domitories = new ArrayList<Domitory>(0);
	private List<TB> TBs = new ArrayList<TB>(0);

	// Constructors

	/** default constructor */
	public Building() {
	}

	/** full constructor */
	public Building(String name, String introduction, List<Domitory> domitories,
			List<TB> TBs) {
		this.name = name;
		this.introduction = introduction;
		this.domitories = domitories;
		this.TBs = TBs;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "introduction", length = 100)
	public String getIntroduction() {
		return this.introduction;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "building")
	public List<Domitory> getDomitories() {
		return this.domitories;
	}

	public void setDomitories(List<Domitory> domitories) {
		this.domitories = domitories;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "building")
	public List<TB> getTBs() {
		return this.TBs;
	}

	public void setTBs(List<TB> TBs) {
		this.TBs = TBs;
	}

}